/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * articulos_sie_inveprogramados.java
 *
 * Created on 24/04/2011, 12:55:59 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;

import java.text.ParseException;
import java.text.*;

/**
 *
 * @author Michelle
 */
public class articulos_sie_inveprogramados extends javax.swing.JFrame {

    private javax.swing.table.DefaultTableModel jtable_modelo;
    private JTable jtable_tiendas;
    private java.util.Date fechahoy=new Date();
    private int visualisa=0,buscamp=1;
    private String esquesele="all";
    bd_conexion x = new bd_conexion();
    ResultSet rs = null;
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private int fidtienda=0,controlcombo=0;


    /** Creates new form articulos_sie_inveprogramados */
    public articulos_sie_inveprogramados() {
        this.iniciar_modelo_de_tabla();
        initComponents();


        jt_catinveprogramados.getTableHeader().setPreferredSize(new Dimension(jt_catinveprogramados.getTableHeader().getWidth(),35));
        jt_catinveprogramados.getTableHeader().setBackground(Color.yellow);
        jt_catinveprogramados.getColumnModel().getColumn(0).setPreferredWidth(90);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(1).setPreferredWidth(150);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(2).setPreferredWidth(150);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(3).setPreferredWidth(90);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(4).setPreferredWidth(90);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(5).setPreferredWidth(70);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(6).setPreferredWidth(70);//tem ent
        jt_catinveprogramados.getColumnModel().getColumn(7).setPreferredWidth(70);//tem ent
        
        fidtienda=variables_global.getidtiendami();
        this.buttonGroup1.setSelected(jrbtn_programados.getModel(), true);
        this.carga_datos(buscamp,fidtienda,"");
        this.setLocation(5,5);
        this.jcbx_tiendas.addItem(variables_global.getidtiendami()+":"+variables_global.getidtiendamidescribe());
        if(variables_global.getnivelusu()<3)
            {
            this.loadcombo();
           
            }
         this.loadcombobodega();
      controlcombo=1;
    }
private void iniciar_modelo_de_tabla()
    {
        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>Id/Status</b></html>");
        jtable_modelo.addColumn("<html><b>Tienda/Descripcion</b></html>");
        jtable_modelo.addColumn("<html><b>Titulo Inventario</b></html>");
        jtable_modelo.addColumn("<html><b>F.Programada</b></html>");
        jtable_modelo.addColumn("<html><b>F.Aplicacion.</b></html>");
        jtable_modelo.addColumn("<html><b>C. Teorica</b></html>");
        jtable_modelo.addColumn("<html><b>C. Fisica</b></html>");
        jtable_modelo.addColumn("<html><b>Diferencia</b></html>");
    }

   private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int fila = jt_catinveprogramados.getSelectedRow();
         String idcadena[]=this.jt_catinveprogramados.getValueAt(fila, 0).toString().split(":");
         String idcadena2[]=this.jt_catinveprogramados.getValueAt(fila, 1).toString().split(":");
         String idcadenatienda[]=this.jt_catinveprogramados.getValueAt(fila, 2).toString().split(":");
         //JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
          if(JOptionPane.showConfirmDialog(null, "<html><h2>Tienda:"+idcadena2[0]+"<br>Inventario:"+idcadenatienda[1]+"<br>Deseas Entrar?</h2></html>")==0)
            {
                articulos_sie_invefisicodetalle fdsi=new articulos_sie_invefisicodetalle(Integer.valueOf(idcadena[0]),Integer.valueOf(idcadenatienda[0]),0,idcadena2[0]);
                fdsi.pack();
                fdsi.setVisible(true);
            }
    }
    private void loadcombo(){
         try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(3,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                        this.jcbx_tiendas.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri"));
                    }
        }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
     private void loadcombobodega(){
         try
            {
               rs = x.sieuno_executediversosv2("select * from x1distribucion_tiendas_activas(4,'','') as (tie_descri character varying(35),tie_id integer,tie_desesque character varying(25),idclie character varying(12));",variables_global.getconexiongral());
               while (rs.next())
                    {
                        this.jcbx_tiendas1.addItem(rs.getString("tie_id")+":"+rs.getString("tie_descri"));
                    }
        }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
   private void carga_datos(int opcion,int idtienda,String busqueda)
    {
       String fechacat = "",fechallegatienda="",fechaentrega="",idtiendastri[]=null;
       DecimalFormat miformat = new DecimalFormat("###,###,###,###");
       while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
       Object[] fnewRow = new Object[8];
       String texto="select * from x1sieuno_articulo_inven_programados("+opcion+","+idtienda+",'"+busqueda+"')  as (id integer,idcon smallint,fechaprog date,horaprog text,fechaaplica date,horaaplica text,fecharevi date,idempleelabora integer,idempleasuper integer,idgerente integer,idsuper integer,cantteo numeric,cantfis numeric, descripinve text,observa text,valorcongel smallint,idstatusconge smallint,descrpstatu character varying(40),descripcongela character varying(40),obsercongelar character varying(80),camponombrecongela character varying(25));";
       System.out.println(texto);
        try
         {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            while (rs.next())
                {
                idtiendastri=rs.getString ("descripinve").split(":");
                fnewRow[0]=rs.getString ("id")+":"+rs.getString ("descrpstatu");
                fnewRow[1]=idtiendastri[0]+":"+rs.getString ("descripcongela");
                fnewRow[2]=idtiendastri[1]+":"+idtiendastri[2];
                fnewRow[3]="<html>"+this.fechaeuropea(rs.getString ("fechaprog"))+":"+DiaSemana(this.fechaeuropea(rs.getString ("fechaprog"))).substring(0, 3)+" "+rs.getString ("horaprog")+"</html>";
                if(rs.getString("fechaaplica") != null)
                        {
                           fechallegatienda="<html>"+ rs.getString("fechaaplica")+":"+DiaSemana(rs.getString ("fechaaplica")).substring(0, 3)+" "+rs.getString ("horaaplica")+"</html>";
                        }
                 fnewRow[4]=fechallegatienda;
                 fnewRow[5]=miformat.format(rs.getFloat("cantteo"));
                 fnewRow[6]=miformat.format(rs.getFloat("cantfis"));
                 fnewRow[7]=miformat.format(rs.getFloat("cantfis")-rs.getFloat("cantteo"));
                 jtable_modelo.addRow(fnewRow);
                }

        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       this.jlbl_regfind.setText("Registros Encontrados:"+this.jtable_modelo.getRowCount());
      //int numerofilas=this.jtable_modelo.getRowCount();
      //       for(int i = 0 ;i < numerofilas; i++)
      //          {
      //               jt_catinveprogramados.setRowHeight(i, 30);
      //          }
        
      }
  private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
  private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }


 private  void ayuda()
            {
                String punto1="1.-Detalle de Recepcion de Mercancia, cada opcion se autodescribe brevemente\n";
                String punto2="  2.- Cada Boton tiene Una letra Resaltada el cual indica su metodo abreviado uselo si desea mayor rapides ( ejemplo Alt+a tendra ayuda automaticamente)\n";
                String punto3="  3.- la opcion guardar esta activada para Recepcionar este documento Incluyendo Diferencias si no ingresa diferencias, el sistema guardara el documento como correcto\n";
                JOptionPane.showMessageDialog(null,punto1+punto2+punto3, "Sistema Integral(Detalle Recepcion) : Ayuda",1);
            }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jbtn_agregar = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jcbx_tiendas = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_busqueda = new javax.swing.JButton();
        jrbtn_folio = new javax.swing.JRadioButton();
        jrbtn_descripcion = new javax.swing.JRadioButton();
        jrbtn_programados = new javax.swing.JRadioButton();
        jcbx_filtrarpendientes = new javax.swing.JCheckBox();
        jrbtn_congelados = new javax.swing.JRadioButton();
        jrbtn_idstatus = new javax.swing.JRadioButton();
        jcbx_tiendas1 = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_catinveprogramados = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jlbl_regfind = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_actualizar = new javax.swing.JMenuItem();
        jmni_escape = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(articulos_sie_inveprogramados.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel1.setName("jPanel1"); // NOI18N

        jbtn_agregar.setIcon(resourceMap.getIcon("jbtn_agregar.icon")); // NOI18N
        jbtn_agregar.setText(resourceMap.getString("jbtn_agregar.text")); // NOI18N
        jbtn_agregar.setName("jbtn_agregar"); // NOI18N
        jbtn_agregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_agregarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jbtn_agregar)
                .addContainerGap(861, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jbtn_agregar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jcbx_tiendas.setToolTipText(resourceMap.getString("jcbx_tiendas.toolTipText")); // NOI18N
        jcbx_tiendas.setName("jcbx_tiendas"); // NOI18N
        jcbx_tiendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendasActionPerformed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_busqueda.setIcon(resourceMap.getIcon("jbtn_busqueda.icon")); // NOI18N
        jbtn_busqueda.setText(resourceMap.getString("jbtn_busqueda.text")); // NOI18N
        jbtn_busqueda.setToolTipText(resourceMap.getString("jbtn_busqueda.toolTipText")); // NOI18N
        jbtn_busqueda.setName("jbtn_busqueda"); // NOI18N
        jbtn_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_busquedaActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_folio);
        jrbtn_folio.setText(resourceMap.getString("jrbtn_folio.text")); // NOI18N
        jrbtn_folio.setToolTipText(resourceMap.getString("jrbtn_folio.toolTipText")); // NOI18N
        jrbtn_folio.setActionCommand(resourceMap.getString("jrbtn_folio.actionCommand")); // NOI18N
        jrbtn_folio.setName("jrbtn_folio"); // NOI18N
        jrbtn_folio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_folioActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_descripcion);
        jrbtn_descripcion.setText(resourceMap.getString("jrbtn_descripcion.text")); // NOI18N
        jrbtn_descripcion.setToolTipText(resourceMap.getString("jrbtn_descripcion.toolTipText")); // NOI18N
        jrbtn_descripcion.setActionCommand(resourceMap.getString("jrbtn_descripcion.actionCommand")); // NOI18N
        jrbtn_descripcion.setName("jrbtn_descripcion"); // NOI18N
        jrbtn_descripcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_descripcionActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_programados);
        jrbtn_programados.setText(resourceMap.getString("jrbtn_programados.text")); // NOI18N
        jrbtn_programados.setToolTipText(resourceMap.getString("jrbtn_programados.toolTipText")); // NOI18N
        jrbtn_programados.setActionCommand(resourceMap.getString("jrbtn_programados.actionCommand")); // NOI18N
        jrbtn_programados.setName("jrbtn_programados"); // NOI18N
        jrbtn_programados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_programadosActionPerformed(evt);
            }
        });

        jcbx_filtrarpendientes.setText(resourceMap.getString("jcbx_filtrarpendientes.text")); // NOI18N
        jcbx_filtrarpendientes.setToolTipText(resourceMap.getString("jcbx_filtrarpendientes.toolTipText")); // NOI18N
        jcbx_filtrarpendientes.setName("jcbx_filtrarpendientes"); // NOI18N
        jcbx_filtrarpendientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_filtrarpendientesActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_congelados);
        jrbtn_congelados.setText(resourceMap.getString("jrbtn_congelados.text")); // NOI18N
        jrbtn_congelados.setToolTipText(resourceMap.getString("jrbtn_congelados.toolTipText")); // NOI18N
        jrbtn_congelados.setActionCommand(resourceMap.getString("jrbtn_congelados.actionCommand")); // NOI18N
        jrbtn_congelados.setName("jrbtn_congelados"); // NOI18N
        jrbtn_congelados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_congeladosActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrbtn_idstatus);
        jrbtn_idstatus.setText(resourceMap.getString("jrbtn_idstatus.text")); // NOI18N
        jrbtn_idstatus.setToolTipText(resourceMap.getString("jrbtn_idstatus.toolTipText")); // NOI18N
        jrbtn_idstatus.setActionCommand(resourceMap.getString("jrbtn_idstatus.actionCommand")); // NOI18N
        jrbtn_idstatus.setName("jrbtn_idstatus"); // NOI18N
        jrbtn_idstatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrbtn_idstatusActionPerformed(evt);
            }
        });

        jcbx_tiendas1.setToolTipText(resourceMap.getString("jcbx_tiendas1.toolTipText")); // NOI18N
        jcbx_tiendas1.setName("jcbx_tiendas1"); // NOI18N
        jcbx_tiendas1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_tiendas1ActionPerformed(evt);
            }
        });

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(257, 257, 257)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jbtn_busqueda)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jcbx_tiendas1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(236, 236, 236)
                        .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_descripcion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_programados)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrbtn_congelados)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jrbtn_idstatus)
                        .addGap(31, 31, 31)
                        .addComponent(jcbx_filtrarpendientes, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(jbtn_busqueda)
                    .addComponent(jcbx_tiendas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4)
                    .addComponent(jcbx_tiendas1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jrbtn_folio, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_descripcion, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_programados, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_congelados, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jcbx_filtrarpendientes, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jrbtn_idstatus, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_catinveprogramados.setFont(resourceMap.getFont("jt_catinveprogramados.font")); // NOI18N
        jt_catinveprogramados.setModel(this.jtable_modelo);
        jt_catinveprogramados.setName("jt_catinveprogramados"); // NOI18N
        jt_catinveprogramados.setRowHeight(26);
        jt_catinveprogramados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catinveprogramadosMouseClicked(evt);
                if(evt.getClickCount() >= 2)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane1.setViewportView(jt_catinveprogramados);

        jlbl_regfind.setText(resourceMap.getString("jlbl_regfind.text")); // NOI18N
        jlbl_regfind.setName("jlbl_regfind"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 994, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jlbl_regfind)
                        .addContainerGap())))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jlbl_regfind, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 451, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_actualizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        jmni_actualizar.setIcon(resourceMap.getIcon("jmni_actualizar.icon")); // NOI18N
        jmni_actualizar.setText(resourceMap.getString("jmni_actualizar.text")); // NOI18N
        jmni_actualizar.setName("jmni_actualizar"); // NOI18N
        jmni_actualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_actualizarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_actualizar);

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jcbx_tiendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendasActionPerformed
     // TODO add your handling code here:
          if (controlcombo > 0 ) {
                if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0)
                        {
                            String arreglo_idtie[]=this.jcbx_tiendas.getSelectedItem().toString().split(":");
                            fidtienda=Integer.valueOf(arreglo_idtie[0]);
                            this.carga_datos(3,Integer.valueOf(arreglo_idtie[0]),"");
                        }
          }
}//GEN-LAST:event_jcbx_tiendasActionPerformed

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
          if(JOptionPane.showConfirmDialog(null, "Realmente Desea Salir?")==0)
                {
                    this.dispose();
                }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_actualizarActionPerformed
        // TODO add your handling code here:
        this.carga_datos(3,fidtienda,"");
    }//GEN-LAST:event_jmni_actualizarActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);

    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jbtn_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_agregarActionPerformed
        // TODO add your handling code here:
        articulos_sie_inveprogramados_agregar fasia=new articulos_sie_inveprogramados_agregar();
        fasia.pack();
        fasia.setVisible(true);
    }//GEN-LAST:event_jbtn_agregarActionPerformed

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_busquedaActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_busquedaActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Estan correcto sus Datos?")==0)
            {
                String arreglo_idtie[]=this.jcbx_tiendas.getSelectedItem().toString().split(":");
                this.carga_datos(buscamp,Integer.valueOf(arreglo_idtie[0]),this.jtf_busqueda.getText().toUpperCase());
            }
    }//GEN-LAST:event_jbtn_busquedaActionPerformed

    private void jrbtn_folioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_folioActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_folioActionPerformed

    private void jrbtn_descripcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_descripcionActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_descripcionActionPerformed

    private void jrbtn_programadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_programadosActionPerformed
        // TODO add your handling code here:
        buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_programadosActionPerformed

    private void jcbx_filtrarpendientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_filtrarpendientesActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Deseas Ver solo Recepciones Pendientes?")==0)
            {
                this.carga_datos(3,fidtienda,"");
            }
}//GEN-LAST:event_jcbx_filtrarpendientesActionPerformed

    private void jrbtn_congeladosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_congeladosActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_congeladosActionPerformed

    private void jrbtn_idstatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrbtn_idstatusActionPerformed
        // TODO add your handling code here:
         buscamp=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrbtn_idstatusActionPerformed

    private void jcbx_tiendas1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_tiendas1ActionPerformed
        // TODO add your handling code here:
        if (controlcombo > 0 ) {
                if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0)
                        {
                            String arreglo_idtie[]=this.jcbx_tiendas1.getSelectedItem().toString().split(":");
                            fidtienda=Integer.valueOf(arreglo_idtie[0]);
                            this.carga_datos(3,Integer.valueOf(arreglo_idtie[0]),"");
                        }
          }
    }//GEN-LAST:event_jcbx_tiendas1ActionPerformed
 private void jt_catinveprogramadosMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new articulos_sie_inveprogramados().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtn_agregar;
    private javax.swing.JButton jbtn_busqueda;
    private javax.swing.JCheckBox jcbx_filtrarpendientes;
    private javax.swing.JComboBox jcbx_tiendas;
    private javax.swing.JComboBox jcbx_tiendas1;
    private javax.swing.JLabel jlbl_regfind;
    private javax.swing.JMenuItem jmni_actualizar;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrbtn_congelados;
    private javax.swing.JRadioButton jrbtn_descripcion;
    private javax.swing.JRadioButton jrbtn_folio;
    private javax.swing.JRadioButton jrbtn_idstatus;
    private javax.swing.JRadioButton jrbtn_programados;
    private javax.swing.JTable jt_catinveprogramados;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
